<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('人员研发列表')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>研发人员：</label>
                                <select id="selP" class="form-control"
			                        name="personId"
			                        data-ajax--url="/system/user/select2"
			                        data-placeholder="请选择人员">
								</select>
                            </li>
                            <li>
                                <label>参与项目：</label>
                                <!-- <input type="text" name="personProjectId"/> -->
                                <select id="selPR" class="form-control"
			                        name="personProjectId"
			                        data-ajax--url="/system/project/select2"
			                        data-placeholder="请选择项目">
								</select>
                            </li>
                            <li>
                                <label>部门（精确查询）：</label>
                                <!-- <input type="text" name="personProjectId"/> -->
                                <select id="selBM" class="form-control"
			                        name="dept1"
			                        data-ajax--url="/system/dept/select2"
			                        data-placeholder="请选择部门">
								</select>
                            </li>
                            <li>
                                <label>部门（模糊查询）：</label>
                                <input type="text" name="deptName1"/>
                            </li>
                          <!--   <li>
                                <label>部门2：</label>
                                <input type="text" name="personProjectId"/>
                                <select id="selBM2" class="form-control"
			                        name="dept2"
			                        data-ajax--url="/system/dept/select2"
			                        data-placeholder="请选择部门">
								</select>
                            </li> -->
                            <li>
                                <label>研发类型：</label>
                                <select name="type">
                                    <option value="">所有</option>
                                    <option value="0">正常</option>
                                    <option value="1">倒班</option>
                                </select>
                            </li>
                            <!-- <li>
                                <label>研发开始时间：</label>
                                <input type="text" class="time-input" placeholder="请选择研发开始时间" name="startDatetime" autocomplete="off"/>
                            </li>
                            <li>
                                <label>结束研发时间：</label>
                                <input type="text" class="time-input" placeholder="请选择结束研发时间" name="endDatetime" autocomplete="off"/>
                            </li>
                            <li>
                                <label>开始研发操作人员：</label>
                                <input type="text" name="startPersionId"/>
                            </li>
                            <li>
                                <label>结束研发操作人：</label>
                                <input type="text" name="endPersionId"/>
                            </li> -->
                            <li>
                                <label>打卡年份：</label>
                                <input type="text" name="clockYear"/>
                            </li>
                            <li>
                                <label>打卡月份：</label>
                                <input type="text" name="clockMonth"/>
                            </li>
                            <li>
                                <label>打卡日期：</label>
                                <input type="text" name="clockDay"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="resetForm()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:clock:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:clock:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:clock:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:clock:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:clock:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:clock:remove')}]];
        var prefix = ctx + "system/clock";
        
        function resetForm(){
        	//$('#selP').
        	$("#selP").val(null).trigger('change');
        	$("#selP").html("");
        	
        	$("#selPR").val(null).trigger('change');
        	$("#selPR").html("");
        	
        	$("#selBM").val(null).trigger('change');
        	$("#selBM").html("");
        	
        	$("#selBM2").val(null).trigger('change');
        	$("#selBM2").html("");
        	
        	$.form.reset();
        }

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "人员研发",
                sortName: "id",
                sortOrder: "desc",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'ID',
                    visible: true
                },
                {
                    field: 'deptName1',
                    title: '部门1'
                },
                {
                    field: 'deptName2',
                    title: '部门2'
                },
                {
                    field: 'user_name',
                    title: '研发人员'
                },
                {
                    field: 'user_name',
                    title: '研发人员'
                },
                {
                    field: 'project_name',
                    title: '参与项目'
                },
                {
                    field: 'type',
                    title: '研发类型',
                    formatter: function(value, row, index) {
                    	return value == 0 ? "正常" : "倒班";
                    }
                },
                {
                    field: 'startDatetime',
                    title: '研发开始时间'
                },
                {
                    field: 'endDatetime',
                    title: '结束研发时间'
                },
                {
                    field: 'start_user_name',
                    title: '开始研发操作人员'
                },
                {
                    field: 'end_user_name',
                    title: '结束研发操作人'
                },
                {
                    field: 'clockYear',
                    title: '打卡年份'
                },
                {
                    field: 'clockMonth',
                    title: '打卡月份'
                },
                {
                    field: 'clockDay',
                    title: '打卡日期'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>